package com.coocaa.ops.admin.v1.upload.ftp;

import com.coocaa.ops.admin.v1.upload.exception.FtpDelException;
import com.coocaa.ops.admin.v1.upload.exception.FtpDownloadException;
import com.coocaa.ops.admin.v1.upload.exception.FtpException;
import com.coocaa.ops.admin.v1.upload.exception.FtpUploadException;
import com.coocaa.ops.admin.v1.upload.ftp.model.ProgressMonitor;
import org.apache.commons.net.ftp.FTPFile;

import java.io.File;

/**
 * @author bijiahao
 * @date : 2019/2/14.
 * @description: ftp 操作接口
 *
 */
public interface IFtpOperations {
    /**
     * 上传
     *
     * @param localFilePath
     * @param remoteFilePath
     */
    void upload(String localFilePath, String remoteFilePath) throws FtpUploadException;

    /**
     * 上传
     * @param localFile
     * @param remoteFilePath
     * @throws FtpUploadException
     */
    void upload(File localFile, String remoteFilePath) throws FtpUploadException;

    /**
     * 上传-带进度监控
     *
     * @param localFilePath
     * @param remoteFilePath
     * @param progressMonitor
     */
    void upload(String localFilePath, String remoteFilePath, ProgressMonitor progressMonitor) throws FtpUploadException;

    /**
     * 上传-带进度监控
     * @param localFile
     * @param remoteFilePath
     * @param progressMonitor
     * @throws FtpUploadException
     */
    void upload(File localFile, String remoteFilePath, ProgressMonitor progressMonitor) throws FtpUploadException;

    /**
     * 下载
     *
     * @param remoteFilePath
     * @param localFilePath
     */
    void download(String remoteFilePath, String localFilePath) throws FtpDownloadException;

    /**
     * 下载-带进度监控
     *
     * @param remoteFilePath
     * @param localFilePath
     * @param progressMonitor
     */
    void download(String remoteFilePath, String localFilePath, ProgressMonitor progressMonitor) throws FtpDownloadException;

    /**
     * 删除文件
     *
     * @param ftpFilePath
     */
    void deleteFtpFile(String ftpFilePath) throws FtpDelException;

    /**
     * 列举ftp 文件
     *
     * @param ftpFilePath
     * @return
     * @throws FtpException
     */
    FTPFile[] listFtpFile(String ftpFilePath) throws FtpException;
}
